package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class AddOperation implements  IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("新增图书");
        int cur=bookList.getUsedSize();
        System.out.println("请输入书籍信息");
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入书籍名称");

        String name=scanner.nextLine();
        System.out.println("请输入书籍作者");
        String author=scanner.nextLine();
        System.out.println("请输入书籍类型");
        String type=scanner.nextLine();
        System.out.println("请输入书籍价格");
        int price=scanner.nextInt();

        Book book =new Book(name,author,price,type);

//        Book book=new Book( "xiaogongguo","zhagsan", 15,"xiaoshuo");
        bookList.setBooks(cur,book);
        cur++;
        bookList.setUsedSize(cur);
    }
}
